import request from '../utils/request'

//获取用户收藏列表
export const getUserFavoriteList = () => {
    return request({
        url: '/favorite/list',
        method: 'get'
    })
}

//查询当前商品是否收藏（返回值为空则没有收藏）
export const isGoodFavorite = (spuId) => {
    return request({
        url: '/favorite/isFavorite',
        method: 'post',
        params: { spuId }
    })
}

//添加到收藏
export const addFavorite = (spuId) => {
    return request({
        url: '/favorite/add',
        method: 'post',
        params: { spuId }
    })
}

//取消收藏
export const cancelFavorite = (spuId) => {
    return request({
        url: '/favorite/cancel',
        method: 'post',
        params: { spuId }
    })
}